<template>
    <div class="event-main">
        <div class="table">
            <div class="th nav">
                <div class="td" style="width: 240px">公司名称</div>
                <div class="td" style="width: 161px">状态</div>
                <div class="td" style="width: 238px">检测区间</div>
                <div class="td" style="width: 205px">获取时间</div>
                <div class="td" style="width: 220px">操作</div>
            </div>
            <div v-for="(item, index) in datalist" :key="index" class="th">
                <div class="td" style="width: 240px">
                    {{ item.companyName }}
                </div>
                <div class="td" style="width: 161px">
                    {{ getstatus(item.status) }}
                </div>
                <div class="td" style="width: 238px">
                    {{
                        item.beginDate ? item.beginDate.substring(0, 4) : ""
                    }}-{{
                        item.beginDate ? item.beginDate.substring(4, 6) : ""
                    }}至{{
                        item.overDate ? item.overDate.substring(0, 4) : ""
                    }}-{{ item.overDate ? item.overDate.substring(4, 6) : "" }}
                </div>
                <div class="td" style="width: 205px">
                    {{ getTime2(item.createtime * 1000) }}
                </div>
                <div class="td" style="width: 220px">
                    <template v-if="item.status == 1">
                        <span class="go" @click="go(item.content)">查看</span>
                        &nbsp;
                        <span @click="go(item.content)">下载</span>
                        &nbsp;
                    </template>
                    <nuxt-link to="/cswd/zjwd/1" target="_blank"
                        >咨询专家</nuxt-link
                    >
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { Sm2service_get_data, getanalysedata2 } from "@/assets/api/indexApi.js";
import { getTime2 } from "@/assets/utils/utils.js";
import { mapMutations, mapState } from "vuex";
export default {
    name: "riskDetection",
    async asyncData({ route }) {
        let data = {
            mateInfo: {
                title: "风险检测",
                keywords: "",
                description: "",
            },
            relateddata: [],
            all_based_source: [],
            dataList: [],
        };

        return data;
    },
    components: {},
    layout: "home",
    head() {
        return {
            __dangerouslyDisableSanitizers: ["script"],
            title: this.mateInfo.title + "-【小竹财税平台】",
            meta: [
                {
                    hid: "description",
                    name: "description",
                    content: this.mateInfo.description,
                },
                {
                    hid: "keywords",
                    name: "keywords",
                    content: this.mateInfo.keywords,
                },
            ],
        };
    },
    data() {
        return {
            datalist: [],
            getstatus: function (status) {
                if (status == 0) return "生成中";
                if (status == 1) return "成功";
                if (status == 2) return "失败";
            },
            getTime2: getTime2,
        };
    },
    computed: {
        ...mapState("common", {
            userInfo: (state) => state.userInfo,
        }),
    },
    created() {},
    beforeMount() {},
    mounted() {
        this.getdata();
        getanalysedata2({
            m_id: 17,
            type: 1,
            describe: "我的报告",
            code: "PW3",
        });
    },
    watch: {},

    methods: {
        ...mapMutations("common", ["setmenuIndex", "setloginShow"]),
        async getdata() {
            const res = await Sm2service_get_data({});
            if (res.code == 1) {
                this.datalist = res.data;
            }
        },

        go(url) {
            window.open(url, "_blank");
        },
    },
};
</script>

<style lang="scss" scoped>
.event-main {
    width: 1200px;
    margin: 13px auto;
    border-radius: 10px;
    padding: 47px 0 800px;
    background-color: #ffffff;
    padding-top: 71px;
}
.table {
    border: 1px solid #000000;
    width: 1063px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    .th {
        display: flex;
        justify-content: center;
        border-bottom: 1px solid #000000;
        &:last-child {
            border: none;
        }
        .td {
            text-align: center;
            line-height: 70px;
            height: 70px;
            border-right: 1px solid #000000;
            color: #333333;
            font-weight: 400;
            font-size: 18px;
            white-space: nowrap; /* 防止文本换行 */
            overflow: hidden; /* 隐藏超出容器宽度的内容 */
            text-overflow: ellipsis; /* 显示省略号 */
            &:last-child {
                border: none;
            }
            span {
                cursor: pointer;
            }
            .go {
                color: #1c87f3;
                text-decoration: underline;
            }
        }
    }

    .nav {
        border-color: #ffffff;

        .td {
            background-color: #1c87f3;
            border-color: #ffffff;
            color: #ffffff;
        }
    }
}
</style>
